[Java] Flood fill using a stack

Posted by dafero on Stack Overflow See other posts from Stack Overflow or by dafero
Published on 2010-05-06T17:43:43Z Indexed on 2010/05/06 17:48 UTC
Read the original article Hit count: 389

Filed under:
|
|
|

Hello to everyone :),

I am using the recursive Flood fill algorithm in Java to fill some areas of a image. With very small images it works fine, but when de image becomes larger the JVM gives me a Stack Over Flow Error.

That's the reason why I have to reimplement the method using a Flood Fill with my own stack. (I read that's the best way to do it in these kind of cases)

Can anyone explain me how to code it? (if you don't have the code at hand, with the pseudo-code of the algorithm will be fine)

I've read a lot in the Internet but I haven't understood it very well.

Thanks!

© Stack Overflow or respective owner

Related posts about flood-fill

Related posts about java